package com.audaque.springboot.foshanupload.web.webdemo.model.dto;



/*import com.audaque.springboot.foshanupload.jwtcore.anno.RsaAnno;*/

import com.audaque.springboot.foshanupload.core.anno.DataMaskAnno;
import com.audaque.springboot.foshanupload.core.anno.DictAnno;
import com.audaque.springboot.foshanupload.core.converter.DateJacksonSerialize2LongConverter;

import com.audaque.springboot.foshanupload.core.enums.DataMask;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.*;
import lombok.NoArgsConstructor;


import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 日期序列化
 *
 * </p>
 *
 * @author zgb
 * @since 2021-12-25
 */
@Schema(description = "日期序列化")
@Data

@NoArgsConstructor
@AllArgsConstructor

public class DateJacksonSerializeDto implements Serializable {
    private static final long serialVersionUID = -1242493306307174690L;

    @Schema(description = "id")
    //解决：long类型序列化时精度丢失
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;


    @NotBlank
    @Schema(description = "更新时间")
    //以时间戳的方式返回给前端
    @JsonSerialize(using = DateJacksonSerialize2LongConverter.class)
    private Date updateDate;


    @NotBlank
    @Schema(description = "事件时间")
    //Date类型序列化时变成long类型造成精度丢失
    private Date eventDate;

    @NotBlank
    @Schema(description = "上报时间,yyyy-MM-dd HH:mm:ss")
    //解决：Date类型序列化时变成long类型造成精度丢失
    @JsonFormat(shape = JsonFormat.Shape.STRING, timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createDate;

    @NotBlank
    @DataMaskAnno(dataMaskFunctionEnum = DataMask.ALL_MASK)
    private String mask;

    @NotBlank
    //@DataMaskAnno(dataMaskFunctionEnum = DataMask.ALL_MASK)
    //@RsaAnno
    private String maskEn;

    @NotBlank
    //@RsaAnno
    private String rsaEn;

    @NotBlank
    //@RsaAnno(enOrde = false)
    private String rsaDe;

    @NotBlank
    @DictAnno(groupCode = "groupCode")
    private String itemCode;

}
